]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[AppSwitcher] Put apps with no window on current workspace at the end.
authorSteve Frécinaux <code@istique.net>
Tue, 29 Sep 2009 17:29:17 +0000 (19:29 +0200)
committerSteve Frécinaux <code@istique.net>
Thu, 1 Oct 2009 21:25:15 +0000 (23:25 +0200)
Following the idea expressed in bug 590563 by mccann ("Minimized or
hidden applications should appear at the end of the list"), we should
also put applications that have no visible window in the active
workspace at the end of the alt-tab window list, after apps which have
minimized windows in the active workspace.

js/ui/altTab.js

index ec23fdabc4d021d1cbe2a269802f9c3c50ca129f..827ae6fa16145870697990c74bc6fdd72dba748c 100644 (file)
@@ -126,6 +126,14 @@ AltTabPopup.prototype = {
         return true;
     },
 
+    _hasWindowsOnWorkspace: function(appIcon, workspace) {
+        for (let i = 0; i < appIcon.windows.length; i++) {
+            if (appIcon.windows[i].get_workspace() == workspace)
+                return true;
+        }
+        return false;
+    },
+
     _hasVisibleWindows : function(appIcon) {
         for (let i = 0; i < appIcon.windows.length; i++) {
             if (appIcon.windows[i].showing_on_its_workspace())
@@ -135,6 +143,22 @@ AltTabPopup.prototype = {
     },
 
     _sortAppIcon : function(appIcon1, appIcon2) {
+        // We intend to sort the application list so applications appear
+        // with this order:
+        //   1. Apps with visible windows on the active workspace;
+        //   2. Apps with minimized windows on the active workspace;
+        //   3. Apps with visible windows on any other workspace;
+        //   4. Other apps.
+
+        let workspace = global.screen.get_active_workspace();
+        let ws1 = this._hasWindowsOnWorkspace(appIcon1, workspace);
+        let ws2 = this._hasWindowsOnWorkspace(appIcon2, workspace);
+
+        if (ws1 && !ws2)
+            return -1;
+        else if (ws2 && !ws1)
+            return 1;
+
         let vis1 = this._hasVisibleWindows(appIcon1);
         let vis2 = this._hasVisibleWindows(appIcon2);